<input type="hidden" name="reply_id" value="{$reply['id']}" />
<div class="panel panel-default">
	<div class="panel-heading">
		参数设置
	</div>
	<div class="panel-body">
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否可以重复抢楼</label>
			<div class="col-sm-9">
				<label class="radio-inline">
					<input type="radio" name="repeat_floor" {if !isset($setting['repeat_floor'])||$setting['repeat_floor']==1}checked{/if} value="1"/>是
				</label>
				<label class="radio-inline">
					<input type="radio" name="repeat_floor" {if isset($setting['repeat_floor']) && $setting['repeat_floor']==0}checked{/if} value="0"/>否
				</label>
				<span class="help-block">
				</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">商家兑换密码</label>
			<div class="col-sm-9">
				<input type="text" class="form-control" name="exchangekey" value="{$setting['exchangekey']}">
				<span class="help-block">用户中奖后，凭领奖界面到商家兑换，商家可输入密码验证是否合法</span>
			</div>
		</div>
	</div>
</div>
<div class="panel panel-default">
	<div class="panel-heading">
		回复内容
	</div>
	<div class="panel-body">
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">楼层提示语</label>
			<div class="col-sm-9">
				<textarea class="form-control" name="currentprompt" placeholder="当前活动：{##RULENAME##}，当前楼层是第 {##FLOOR##} 楼！">{$item['currentprompt']}</textarea>
				<span class="help-block">
					{##RULENAME##} 表示当前活动<br/>
					{##FLOOR##} 表示当前楼层<br/>
					请根据您的需要填写，如：第{##FLOOR##}楼<br/>
					(此状态下用户点击微信返回图文消息将连接至活动中奖名单页面)<br/>
					<strong class="text-danger">如果不填，则为默认为：当前活动：{##RULENAME##}，当前楼层是第 {##FLOOR##} 楼！</strong>
				</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖提示语</label>
			<div class="col-sm-9">
				<textarea class="form-control" name="awardprompt" placeholder="当前活动：{##RULENAME##}，恭喜您，当前楼层是第 {##FLOOR##} 楼，获得 {##AWARD##} 奖品！">{$item['awardprompt']}</textarea>
				<span class="help-block">
					{##RULENAME##} 表示当前活动<br/>
					{##FLOOR##} 表示当前楼层<br/>
					{##AWARD##} 表示奖品名称<br/>
					{##DESCRIPTION##} 表示奖品描述<br/>
					请根据您的需要填写，如：第{##FLOOR##}楼，中奖啦，奖品是{##AWARD##}{##DESCRIPTION##}<br/>
					(此状态下用户点击微信返回图文消息判断如果用户已存在中奖信息，则链接至已中奖品列表页面，否则链接至提交中奖信息页面)<br/>
					<strong class="text-danger">如果不填，则为默认为：当前活动：{##RULENAME##}，恭喜您，当前楼层是第 {##FLOOR##} 楼，获得 {##AWARD##} 奖品！</strong>
				</span>
			</div>
		</div>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">已参加提示语</label>
			<div class="col-sm-9">
				<textarea class="form-control" name="floorprompt" placeholder="当前活动：{##RULENAME##}，您已参与过本活动，楼层为 {##FLOOR##} 楼，盖楼时间为 {##TIME##}，谢谢您的参与！">{$item['floorprompt']}</textarea>
				<span class="help-block">
					注意：关闭重复抢楼时，需设置已参与抢楼活动的提示语。<br/>
					{##RULENAME##} 表示当前活动<br/>
					{##FLOOR##} 表示当前楼层<br/>
					{##TIME##} 表示参与时间<br/>
					请根据您的需要填写，如：您已参与过本活动，楼层为 {##FLOOR##} 楼，盖楼时间为 {##TIME##}<br/>
					(此状态下用户点击微信返回图文消息将连接至活动中奖名单页面)<br/>
					<strong class="text-danger">如果不填，则为默认为：当前活动：{##RULENAME##}，您已参与过本活动，楼层为 {##FLOOR##} 楼，盖楼时间为 {##TIME##}，谢谢您的参与！</strong>
				</span>
			</div>
		</div>
	</div>
</div>
<div class="panel panel-default">
	<div class="panel-heading">
		奖品信息
	</div>
	<input type="hidden" name="reply_id" value="{$reply['id']}" />
	<div class="panel-body">
		{if $awards}
			{loop $awards $item}
			<div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖楼层</label>
					<div class="col-sm-9">
						<input type="text" placeholder="请输入中奖楼层数字，可输入多个楼层数字，中间用英文逗号分隔，例如：9,99,999,9999" class="form-control" name="award_floor[{$item[id]}]" value="{$item[floors]}">
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品名称</label>
					<div class="col-sm-9">
						<input type="text" placeholder="请输入奖品名称" class="form-control" name="award_title[{$item[id]}]" value="{$item[title]}">
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品描述</label>
					<div class="col-sm-9">
						<input type="text" placeholder="请输入奖品描述" class="form-control" name="award_desc[{$item[id]}]" value="{$item[description]}">
						<span class="help-block"></span>
					</div>
				</div>
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
					<div class="col-sm-9">
						<a class="btn btn-danger" href="{$item[delete_url]}">
							删除
						</a>
					</div>
				</div>
				<hr/>
			</div>
			{/loop}
		{else}
		<div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">中奖楼层</label>
				<div class="col-sm-9">
					<input type="text" placeholder="请输入中奖楼层数字，可输入多个楼层数字，中间用英文逗号分隔，例如：9,99,999,9999" class="form-control" name="newaward_floor[]">
					<span class="help-block"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品名称</label>
				<div class="col-sm-9">
					<input type="text" placeholder="请输入奖品名称" class="form-control" name="newaward_title[]">
					<span class="help-block"></span>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label">奖品描述</label>
				<div class="col-sm-9">
					<input type="text" placeholder="请输入奖品描述" class="form-control" name="newaward_desc[]">
					<span class="help-block"></span>
				</div>
			</div>
			<!--<div class="form-group">
				<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
				<div class="col-sm-9">
					<button type="button" class="btn btn-danger btn_del_award">
						删除
					</button>
				</div>
			</div>-->
			<hr/>
		</div>
		{/if}
		<span id="award_insert_flag" style="display: none"></span>
		<div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label">
			</label>
			<div class="col-sm-9">
				<button id="btn_add_award" type="button" class="btn btn-warning">
					<span class="glyphicon glyphicon-plus"></span> 添加奖品
				</button>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	function validateReplyForm(formobj, $, _, util, $scope, $http) {
		/*if (formobj['newaward_floor[]'].value == '') {
			util.message('请填写中奖楼层', '', 'error');
			return false;
		}
		if (formobj['newaward_title[]'].value == '') {
			util.message('请填写奖品名称', '', 'error');
			return false;
		}
		if (formobj['newaward_desc[]'].value == '') {
			util.message('请填写奖品描述', '', 'error');
			return false;
		}*/
	}
	var award_row_data = [
		['中奖楼层', '<input type="text" placeholder="请输入中奖楼层数字，可输入多个楼层数字，中间用英文逗号分隔，例如：9,99,999,9999" class="form-control" name="newaward_floor[]">', ''],
		['奖品名称', '<input type="text" placeholder="请输入奖品名称" class="form-control" name="newaward_title[]">', ''],
		['奖品描述', '<input type="text" placeholder="请输入奖品描述" class="form-control" name="newaward_desc[]">', ''],
	];
	$('#btn_add_award').bind('click', function(){
		var content = '', v = '';
		content += '<div>';
		for (var i=0; i<award_row_data.length; i++) {
			v = award_row_data[i];
			content += '<div class="form-group">';
			content += '<label class="col-xs-12 col-sm-3 col-md-2 control-label">'+v[0]+'</label>';
			content += '<div class="col-sm-9">';
			content += v[1];
			content += '<span class="help-block">'+v[2]+'</span>';
			content += '</div>';
			content += '</div>';
		}
		content += '<div class="form-group">';
		content += '<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>';
		content += '<div class="col-sm-9">';
		content += '<button type="button" class="btn btn-danger btn_del_award">删除</button>';
		content += '</div>';
		content += '</div>';
		content += '<hr/>';
		content += '</div>';
		$('#award_insert_flag').before(content);
		$('.btn_del_award').bind('click', function(){
			var obj = $(this).parent().parent().parent();
			obj.slideUp(300, function() {
				obj.remove();
			});
		});
	});
	$(document).ready(function(){
		//$('#btn_add_award').trigger('click');
	});
</script>